CREATE TABLE [dbo].[TMAUXI]
(
[CO_EMPR] [dbo].[TD_VC_002] NOT NULL,
[TI_AUXI_EMPR] [dbo].[TD_VC_001] NOT NULL,
[CO_AUXI_EMPR] [dbo].[TD_VC_020] NOT NULL,
[AP_PATE_AUXI] [dbo].[TD_VC_020] NULL,
[AP_MATE_AUXI] [dbo].[TD_VC_020] NULL,
[NO_NATU_AUX1] [dbo].[TD_VC_020] NULL,
[NO_NATU_AUX2] [dbo].[TD_VC_020] NULL,
[NO_RAZO_SOCI] [dbo].[TD_VC_050] NULL,
[NO_AUXI] [dbo].[TD_VC_050] NOT NULL,
[NO_DIRE] [dbo].[TD_VC_100] NULL,
[CO_UBIC_GEOG] [dbo].[TD_VC_006] NULL,
[CO_PAIS] [dbo].[TD_VC_003] NULL,
[NU_RUCS] [dbo].[TD_VC_020] NULL,
[NU_TLFN] [dbo].[TD_VC_020] NULL,
[NU_FAXE] [dbo].[TD_VC_020] NULL,
[NO_REPR] [dbo].[TD_VC_050] NULL,
[CO_AUXI_CORP] [dbo].[TD_VC_020] NULL,
[CO_DOCU_SUNA] [dbo].[TD_VC_003] NULL,
[NU_DOCU_SUNA] [dbo].[TD_VC_020] NULL,
[TI_PERS_SUNA] [dbo].[TD_VC_003] NULL,
[NU_RETE_SUNA] [dbo].[TD_VC_020] NULL,
[ST_RETE] [dbo].[TD_VC_001_SINO] NULL,
[ST_BCON] [dbo].[TD_VC_001_SINO] NULL,
[ST_DETR] [dbo].[TD_VC_001_SINO] NULL,
[ST_PERC] [dbo].[TD_VC_001_SINO] NULL,
[TI_SITU] [dbo].[TD_VC_003] NOT NULL,
[DE_DIRE_MAIL] [dbo].[TD_VC_100] NULL,
[DE_REFE] [dbo].[TD_VC_100] NULL,
[CO_USUA_CREA] [dbo].[TD_VC_008_USUA] NULL CONSTRAINT [DF__TMAUXI__CO_USUA___5535A963] DEFAULT (substring(suser_sname(),(1),(8))),
[FE_USUA_CREA] [dbo].[TD_DT_001_SIST] NULL CONSTRAINT [DF__TMAUXI__FE_USUA___5629CD9C] DEFAULT (getdate()),
[CO_USUA_MODI] [dbo].[TD_VC_008_USUA] NULL CONSTRAINT [DF__TMAUXI__CO_USUA___571DF1D5] DEFAULT (substring(suser_sname(),(1),(8))),
[FE_USUA_MODI] [dbo].[TD_DT_001_SIST] NULL CONSTRAINT [DF__TMAUXI__FE_USUA___5812160E] DEFAULT (getdate())
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[TMAUXI] WITH NOCHECK ADD CONSTRAINT [CK__TMAUXI__ST_BCON__52593CB8] CHECK NOT FOR REPLICATION (([ST_BCON]='N' OR [ST_BCON]='S'))
GO
ALTER TABLE [dbo].[TMAUXI] WITH NOCHECK ADD CONSTRAINT [CK__TMAUXI__ST_DETR__534D60F1] CHECK NOT FOR REPLICATION (([ST_DETR]='N' OR [ST_DETR]='S'))
GO
ALTER TABLE [dbo].[TMAUXI] WITH NOCHECK ADD CONSTRAINT [CK__TMAUXI__ST_PERC__5441852A] CHECK NOT FOR REPLICATION (([ST_PERC]='N' OR [ST_PERC]='S'))
GO
ALTER TABLE [dbo].[TMAUXI] WITH NOCHECK ADD CONSTRAINT [CK__TMAUXI__ST_RETE__5165187F] CHECK NOT FOR REPLICATION (([ST_RETE]='N' OR [ST_RETE]='S'))
GO
ALTER TABLE [dbo].[TMAUXI] ADD CONSTRAINT [PK__TMAUXI__0F51E12D77AABCF8] PRIMARY KEY CLUSTERED  ([CO_EMPR], [TI_AUXI_EMPR], [CO_AUXI_EMPR]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[TMAUXI] ADD CONSTRAINT [FK__TMAUXI__CO_PAIS__2CDD9F46] FOREIGN KEY ([CO_PAIS]) REFERENCES [dbo].[TTPAIS] ([CO_PAIS])
GO
ALTER TABLE [dbo].[TMAUXI] ADD CONSTRAINT [FK__TMAUXI__CO_UBIC___2DD1C37F] FOREIGN KEY ([CO_UBIC_GEOG]) REFERENCES [dbo].[TTUBIC_GEOG] ([CO_UBIC_GEOG])
GO
ALTER TABLE [dbo].[TMAUXI] ADD CONSTRAINT [FK__TMAUXI__2EC5E7B8] FOREIGN KEY ([TI_AUXI_EMPR], [CO_EMPR]) REFERENCES [dbo].[TTAUXI] ([TI_AUXI_EMPR], [CO_EMPR])
GO
ALTER TABLE [dbo].[TMAUXI] ADD CONSTRAINT [FK__TMAUXI__TI_SITU__2BE97B0D] FOREIGN KEY ([TI_SITU]) REFERENCES [dbo].[TTSITU] ([TI_SITU])
GO
GRANT SELECT ON  [dbo].[TMAUXI] TO [public]
GRANT INSERT ON  [dbo].[TMAUXI] TO [public]
GRANT DELETE ON  [dbo].[TMAUXI] TO [public]
GRANT UPDATE ON  [dbo].[TMAUXI] TO [public]
GO
